<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单计算年龄案例</title>
    <script>
        var age = prompt('请输入你的出生年份');

        console.log('你今年' + (2020 - parseInt(age)) + '岁')
    </script>
</head>

<body>

</body>

</html>